﻿<?xml version="1.0" encoding="utf-8" ?>
<c2eventsheet>
    <!--All the 'name' attributes are ignored by Construct 2 - they are there for readability only.-->
    <name>Main Events</name>
    <events>
        <variable constant="0" name="CurrentEnemyIID" static="0" type="number">0</variable>
        <event-block>
            <conditions>
                <condition id="-6" name="Every X seconds" type="System">
                    <param id="0" name="Interval (seconds)">0.5</param>
                </condition>
            </conditions>
            <actions>
                <action id="-3" name="Create object" type="System">
                    <param id="0" name="Object to create">Enemy</param>
                    <param id="1" name="Layer">&quot;Main&quot;</param>
                    <param id="2" name="X">0</param>
                    <param id="3" name="Y">150</param>
                </action>
            </actions>
            <sub-events>
                <event-block>
                    <conditions>
                        <condition id="-13" name="Pick nth instance" type="System">
                            <param id="0" name="Object">PathPoint</param>
                            <param id="1" name="Instance">Enemy.CurrentDestination</param>
                        </condition>
                    </conditions>
                    <actions>
                        <action id="-22" name="Set angle toward position" type="Enemy">
                            <param id="0" name="X">PathPoint.X</param>
                            <param id="1" name="Y">PathPoint.Y</param>
                        </action>
                    </actions>
                </event-block>
            </sub-events>
        </event-block>
        <event-block>
            <conditions>
                <condition id="0" name="On collision with another object" type="Enemy">
                    <param id="0" name="Object">PathPoint</param>
                </condition>
            </conditions>
            <actions>
                <action id="-10" name="Set value" type="Enemy">
                    <param id="0" name="Instance variable">CurrentDestination</param>
                    <param id="1" name="Value">PathPoint.IID + 1</param>
                </action>
                <action id="-9" name="Set value" type="System">
                    <param id="0" name="Variable">CurrentEnemyIID</param>
                    <param id="1" name="Value">Enemy.IID</param>
                </action>
            </actions>
            <sub-events>
                <event-block>
                    <conditions>
                        <condition id="-19" name="Pick all" type="System">
                            <param id="0" name="Object">PathPoint</param>
                        </condition>
                        <condition id="-13" name="Pick nth instance" type="System">
                            <param id="0" name="Object">PathPoint</param>
                            <param id="1" name="Instance">Enemy.CurrentDestination</param>
                        </condition>
                    </conditions>
                    <actions>
                        <action id="-22" name="Set angle toward position" type="Enemy">
                            <param id="0" name="X">PathPoint.X</param>
                            <param id="1" name="Y">PathPoint.Y</param>
                        </action>
                    </actions>
                </event-block>
            </sub-events>
        </event-block>
        <event-block>
            <conditions>
                <condition behavior="Turret" id="1" name="On shoot" type="Tower" />
            </conditions>
            <actions>
                <action id="0" name="Spawn another object" type="Tower">
                    <param id="0" name="Object">Bullet</param>
                    <param id="1" name="Layer">&quot;Main&quot;</param>
                    <param id="2" name="Image point">0</param>
                </action>
            </actions>
        </event-block>
        <event-block>
            <conditions>
                <condition id="-2" name="On start of layout" type="System" />
            </conditions>
            <actions>
                <action behavior="Turret" id="1" name="Add object to target" type="Tower">
                    <param id="0" name="Target">Enemy</param>
                </action>
            </actions>
        </event-block>
        <event-block>
            <conditions>
                <condition id="0" name="On collision with another object" type="Bullet">
                    <param id="0" name="Object">Enemy</param>
                </condition>
            </conditions>
            <actions>
                <action id="-9" name="Destroy" type="Enemy" />
            </actions>
        </event-block>
        <event-block>
            <conditions>
                <condition id="0" name="On click" type="Mouse">
                    <param id="0" name="Mouse button">0</param>
                    <param id="1" name="Click type">0</param>
                </condition>
            </conditions>
            <actions>
                <action id="-3" name="Create object" type="System">
                    <param id="0" name="Object to create">Tower</param>
                    <param id="1" name="Layer">&quot;Main&quot;</param>
                    <param id="2" name="X">Mouse.X</param>
                    <param id="3" name="Y">Mouse.Y</param>
                </action>
            </actions>
        </event-block>
    </events>
</c2eventsheet>
